public class Purchase implements Runnable{

private int TricketCount = 10;

    @Override
    public void run() {
        while(true){
            if(TricketCount <= 0){
                break;
            }
            try {
                Thread.sleep(100);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
            System.out.println(Thread.currentThread().getName()+"--->拿到了第"+TricketCount--+"票");

        }
    }

    public static void main(String[] args) {

        Purchase purchase = new Purchase();
       new Thread(purchase,"小明").start();
       new Thread(purchase,"小红").start();
       new Thread(purchase,"黄牛党").start();



    }
}
